package com.buddy.sds.auth.oauth2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buddy.sds.auth.oauth2.entity.SystemOauthClient;
import com.buddy.sds.auth.oauth2.mapper.ISystemOauthClientMapper;
import com.buddy.sds.auth.oauth2.service.ISystemOauthClientService;
import org.springframework.stereotype.Service;

@Service
public class ISystemOauthClientServiceImpl extends ServiceImpl<ISystemOauthClientMapper, SystemOauthClient> implements ISystemOauthClientService {
    @Override
    public boolean checkAppId(String clientId) {

        return  baseMapper.selectOne(new LambdaQueryWrapper<SystemOauthClient>().eq(SystemOauthClient::getClientAppid,clientId)) != null;
    }

    @Override
    public boolean checkSecret(String clientId, String secret) {

        return baseMapper.selectOne(new LambdaQueryWrapper<SystemOauthClient>().eq(SystemOauthClient::getClientAppid,clientId).eq(SystemOauthClient::getClientSecret,secret)) != null;

    }
}
